package com.jkdz.spyke.rs
{
	import com.jkgh.remedy.core.client.*;
	import flash.utils.ByteArray;

	public class SpykePaintRemoter implements RemedyRemoter
	{
		private var mo:SpykePaint;

		public function SpykePaintRemoter(mo:SpykePaint)
		{
			this.mo = mo;
		}

		public function call(methodID:int, connection:RemedyClientServerConnection, onReturn:Function):void
		{
			switch (methodID)
			{
				case 41:
					mo.getPaintSettings(function(ret:PaintSettings):void {
						onReturn(ret, RemedyDOClassManager.INSTANCE);
					});
					break;
			}
		}

		public function run(methodID:int, connection:RemedyClientServerConnection):void
		{
			switch (methodID)
			{
				case 43:
					var a_43:SpykePaintListener = (SpykePaintListener)(RemedyMOClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.registerListener(a_43);
					break;
				case 42:
					var a_42:int = (int)(RemedyIntegerClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					var b_42:int = (int)(RemedyIntegerClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					var c_42:int = (int)(RemedyIntegerClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					var d_42:int = (int)(RemedyIntegerClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.drawNewLine(a_42, b_42, c_42, d_42);
					break;
				case 44:
					var a_44:PaintSettings = (PaintSettings)(RemedyDOClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.resetPaint(a_44);
					break;
				case 67:
					mo.unPublish();
					break;
				case 66:
					mo.publish();
					break;
			}
		}
	}
}
